package com.asd.map.mapper;

import com.asd.map.entity.Point_position;
import com.asd.map.entity.vo.Point_positionVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author
 * @createtime 2021-09-02 8:47
 * @description
 */
@Mapper
@Component
public interface Point_positiontableMapper extends BaseMapper<Point_position> {



    List<Point_position> getByDid(@Param("did") String did);

    @Select("select * from point_position where did = #{did}")
    List<Point_position> findByDid(Page<Point_position> positionPage, @Param("did")String did);


    @Select("select * from point_position where did = #{did}")
    List<Point_positionVo> findByDid1(Page<Point_positionVo> positionVoPage, @Param("did")String did);




    @Select("select a.lng,a.lat,a.data,b.primaryEchoPath from point_position a  LEFT JOIN images b ON a.id =b.pid  where did = #{did}")
    List<Point_positionVo> getByDid1(@Param("did") String did);

    @Select("select * from point_position  where id = #{pid}")
    Point_positionVo getById(@Param("pid") String pid);

    @Delete("delete from point_position where did = #{did}")
    void deleteByDid(@Param("did")String did);

    @Update("update point_position set lng =#{lng},lat =#{lat} where id = #{id}")
    void updatePointModification(@Param("id") String id, @Param("lng") String lng, @Param("lat") String lat);

    @Select("select * from point_position where point_position.data like CONCAT('%',#{0},'%')")
    List<Point_position> queryByData(String data);
}
